package org.example.game.biweekly.game138;

/**
 * @Description: TODO
 * @Author wyatt
 * @Data 2024/08/03 20:46
 */
public class Solution002 {

    public static void main(String[] args) {
        System.out.println((int) 'a' -97);

        System.out.println(new Solution002().stringHash("abcd", 2));
    }

    public String stringHash(String s, int k) {
        int x = 'a';
        String res = "";
        int n = s.length();
        int count = n/k;

        for (int i = 0; i < count; i++) {
            String subStr = s.substring(i*k, (i+1)*k);
            int subSum = 0;
            for (int j = 0; j < subStr.length(); j++) {
                subSum+= subStr.charAt(j) - x;
            }
            res = res.concat(String.valueOf((char) (subSum%26 + x)));
        }
        return res;
    }

}
